<!DOCTYPE html>
<html>
  <head lang="en">
    <meta charset="UTF-8" />
    <title>:nth-child()</title>
    <style type="text/css">
      thead tr:nth-child(1) {
        background-color: yellow;
      }
      tbody tr:nth-child(odd) {
        color: orange;
      }
      tbody tr:nth-child(even) {
        color: green;
      }
    </style>
  </head>
  <body>
    <table border="1" cellspacing="0" width="200">
      <thead>
        <tr>
          <th>序号</th>
          <th>姓名</th>
          <th>性别</th>
          <th>年纪</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>1</td>
          <td>张三</td>
          <td>男</td>
          <td>12</td>
        </tr>
        <tr>
          <td>2</td>
          <td>李四</td>
          <td>女</td>
          <td>11</td>
        </tr>
        <tr>
          <td>3</td>
          <td>赵五</td>
          <td>男</td>
          <td>12</td>
        </tr>
        <tr>
          <td>4</td>
          <td>王二</td>
          <td>男</td>
          <td>12</td>
        </tr>
      </tbody>
    </table>
  </body>
</html>
